package net.huashitong.Indicators.dao;

import org.springframework.stereotype.Repository;

import net.huashitong.Indicators.entity.Analysis;
import net.huashitong.Indicators.filter.IndicatorBreakdownFilter;

import com.sirdc.modules.core.dao.GenericQuery;
import com.sirdc.modules.core.dao.StringDao;

@Repository
public class AnalysisDao extends StringDao<Analysis> {

	public Analysis getByIndIdAndDate(IndicatorBreakdownFilter filter) {
		GenericQuery query = createQuery("obj");
		query.append(" and obj.indicatorId = :indicatorId").setParam("indicatorId", filter.getIndustryId());
		query.append(" and obj.date = :date").setParam("date", filter.getCurrentMonth());
		query.append(" and obj.area = :area").setParam("area", filter.getArea());
	   return query.singleResult();
	}

}
